home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / c-runtime / dispatch / Object.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-18  |  4.8 KB  |  176 lines

  1. /* -*-c-*- */
  2.  
  3. /* Copyright (C) 1989, 1992 Free Software Foundation, Inc.
  4.  
  5. This file is part of GNU CC.
  6.  
  7. GNU CC is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2, or (at your option)
  10. any later version.
  11.  
  12. GNU CC is distributed in the hope that it will be useful,
  13. but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. GNU General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with GNU CC; see the file COPYING.  If not, write to
  19. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  20.  
  21. /* As a special exception, if you link this library with files
  22.    compiled with GCC to produce an executable, this does not cause
  23.    the resulting executable to be covered by the GNU General Public License.
  24.    This exception does not however invalidate any other reasons why
  25.    the executable file might be covered by the GNU General Public License.  */
  26.  
  27. /* 
  28.   $Header: /usr/user/dennis_glatting/ObjC/c-runtime/dispatch/RCS/Object.h,v 0.13 1992/08/18 04:46:58 dglattin Exp $
  29.   $Author: dglattin $
  30.   $Date: 1992/08/18 04:46:58 $
  31.   $Log: Object.h,v $
  32.  * Revision 0.13  1992/08/18  04:46:58  dglattin
  33.  * Saving a working version before release.
  34.  *
  35.  * Revision 0.12  1992/04/13  11:43:08  dennisg
  36.  * Check in after array version of run-time works.
  37.  * Expect more changes as hash version and other changes are made.
  38.  *
  39.  * Revision 0.11  1992/01/03  02:55:03  dennisg
  40.  * modified to handle new initialization scheme.
  41.  * fixed code structure.
  42.  *
  43.  * Revision 0.10  1991/12/31  20:13:03  dennisg
  44.  * Deleted index variable stuff.  Index variables are a hack to the language.
  45.  *
  46.  * Revision 0.9  1991/12/07  00:49:28  dennisg
  47.  * deleted +description:.
  48.  *
  49.  * Revision 0.8  1991/12/06  00:35:05  dennisg
  50.  * deleted perform:with:: method.
  51.  *
  52.  * Revision 0.7  1991/11/30  14:19:18  dennisg
  53.  * implemented archiving.
  54.  *
  55.  * Revision 0.6  1991/11/29  20:01:29  dennisg
  56.  * fixed several const decls.  bozo.
  57.  *
  58.  * Revision 0.5  1991/11/20  02:06:30  dennisg
  59.  * returned doesNotRecognize:
  60.  *
  61.  * Revision 0.4  1991/11/19  12:37:24  dennisg
  62.  * minr changes.  still in a state of flux.
  63.  *
  64.  * Revision 0.3  1991/11/16  13:32:58  dennisg
  65.  * changed #import statements to #include.
  66.  * this should make gcc2 happy -- geez.
  67.  *
  68.  * Revision 0.2  1991/11/07  22:30:54  dennisg
  69.  * added copyleft
  70.  *
  71.  * Revision 0.1  1991/10/24  00:45:39  dennisg
  72.  * Initial check in.  Preliminary development stage.
  73.  *
  74. */
  75.  
  76.  
  77. #ifndef _object_INCLUDE_GNU
  78. #define _object_INCLUDE_GNU
  79.  
  80. #include  <objc.h>
  81. #include  <stdio.h>
  82. #include  <sys/types.h>
  83.  
  84. #ifdef  __NeXT__
  85. /* Need prototypes for read() and write(). 
  86.   Most machines put these in stdio.h! */
  87. #include  <libc.h>
  88. #endif
  89.  
  90.  
  91.  
  92. /*
  93.  * All classes are derived from Object.  As such this is the 
  94.  *  overhead tacked onto those objects.  
  95.  */
  96. @interface Object {
  97.   Class_t isa;                                  /* A pointer to the instance's 
  98.                                                   class structure. 
  99.                                                   
  100.                                                   This structure is the one
  101.                                                   generated by the compiler
  102.                                                   and located in the TEXT 
  103.                                                   segment.  The run-time uses
  104.                                                   its address as a key to 
  105.                                                   run-time information. */
  106. }
  107.  
  108. /* Creating, copying, and freeing instances */
  109.  
  110. + new;
  111. + free;
  112. - free;
  113. - copy;
  114. - shallowCopy;
  115. - deepCopy;
  116.  
  117. /* Identifying classes */
  118.  
  119. + ( Class_t )class;
  120. + ( Class_t )superClass;
  121. - ( Class_t )class;
  122. - ( Class_t )superClass;
  123. - ( const char* )name;
  124.  
  125. /* Identifying and comparing instances */
  126.  
  127. - self;
  128. - ( u_int )hash;
  129. - ( BOOL )isEqual:anObject;
  130.  
  131. /* Testing inheritance relationships */
  132.  
  133. - ( BOOL )isKindOf:( Class_t )aClassObject;
  134. - ( BOOL )isMemberOf:( Class_t )aClassObject;
  135. - ( BOOL )isKindOfGivenName:( const char* )aClassName;
  136. - ( BOOL )isMemberOfGivenName:( const char* )aClassName;
  137.  
  138. /* Testing class functionality */
  139.  
  140. + ( BOOL )instancesRespondTo:( SEL )aSel;
  141. - ( BOOL )respondsTo:( SEL )aSel;
  142.  
  143. /* Sending messages determined at run time */
  144.  
  145. - perform:( SEL )aSel;
  146. - perform:( SEL )aSel with:aObject;
  147.  
  148. /* Posing */
  149.  
  150. + poseAs:( Class_t )aClassObject;
  151.  
  152. /* Enforcing intentions */
  153.  
  154. - subclassResponsibility:( SEL )aSel;
  155. - notImplemented:( SEL )aSel;
  156.  
  157. /* Error handling */
  158.  
  159. - doesNotRecognize:(SEL)aSelector;
  160. - error:( const char* )aString, ...;
  161. + error:( const char* )aString, ...;
  162.  
  163. /* Archiving */
  164.  
  165. - storeOn:( int )aFd;
  166. + readFrom:( int )aFd;
  167. - readFrom:( int )aFd;
  168. + ( int )version;
  169. + setVersion:( int )aVersion;
  170.  
  171. @end
  172.  
  173.  
  174. #endif
  175.  
  176.